#pragma once

#include <iostream>
#include <unistd.h>
#include <fcntl.h>
#include <cstring>
#include <cerrno>

void SetNonBlock(int fd)
{
    // 将fd设置为非阻塞
    int fl = fcntl(fd, F_GETFL); // 获取一下fd的状态(GETFD 获取值)
    if (fl < 0)
    {
        std::cerr << "fcntl: " << strerror(errno) << std::endl;
        return;
    }

    fcntl(fd, F_SETFL, fl | O_NONBLOCK);
}


void printlog()
{
    std::cout << "this is a print log!" << std::endl;
}

void installlog()
{
    std::cout << "this is a install log!" << std::endl;
}
